﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="InfoJetServiceDemo._Default" ValidateRequest="false"%>
<HTML>
	<HEAD>
		<title>InfoJet Service 3.0 Demo Application</title>
		<base target="_self">
		<link title="winter" media="all" href="css/calendar-blue.css" type="text/css"
			rel="stylesheet"></link>
		<script src="js/calendar.js" type="text/javascript"></script>
		<script src="js/calendar-en.js" type="text/javascript"></script>
		<script src="js/calendar-setup.js" type="text/javascript"></script>
		<script src="js/nicEdit.js"></script>
		<script src="js/nicEdit.custom.js"></script>
		<script src="js/infojet.js"></script>
		<script language="javascript">
			function InfoJetCustom_OnPostbackStart(){
				var saveFormButton = document.getElementById( "SaveFormButton" );
				if( saveFormButton ){ saveFormButton.disabled = true; }
				var downloadXMLButton = document.getElementById( "DownloadXMLButton" );
				if( downloadXMLButton ){ downloadXMLButton.disabled = true; };
				var printableVersionButton = document.getElementById( "PrintableVersionButton" );
				if (printableVersionButton) { printableVersionButton.disabled = true; };
				/*
				var closeFormButton = document.getElementById( "CloseFormButton" );
				if( closeFormButton ){ closeFormButton.disabled = true; };
				var closeWindowButton = document.getElementById( "CloseWindowButton" );
				if( closeWindowButton ){ closeWindowButton.disabled = true; };
				*/
			}
			function InfoJetCustom_OnPostbackEnd(){
				var saveFormButton = document.getElementById( "SaveFormButton" );
				if( saveFormButton ){ saveFormButton.disabled = false; }
				var downloadXMLButton = document.getElementById( "DownloadXMLButton" );
				if( downloadXMLButton ){ downloadXMLButton.disabled = false; };
				var printableVersionButton = document.getElementById( "PrintableVersionButton" );
				if (printableVersionButton) { printableVersionButton.disabled = false; };
				/*
				var closeFormButton = document.getElementById( "CloseFormButton" );
				if( closeFormButton ){ closeFormButton.disabled = false; };
				var closeWindowButton = document.getElementById( "CloseWindowButton" );
				if( closeWindowButton ){ closeWindowButton.disabled = false; };
				*/
			}
			/*
			function InfoJetCustom_SubmitToHost(){
			    DownloadXML();
			}
			function InfoJetCustom_AttachFile( fileAttachment, formId ){
			    alert( "InfoJetCustom_AttachFile not implemented." );
			}
			function InfoJetCustom_OnInlinePictureClick( event, inlinePicture, formId ){
			    alert( inlinePicture.outerHTML );
			}
			function InfoJetCustom_OnLinkedPictureClick( event , linkedPicture ){
			    alert( "InfoJetCustom_OnLinkedPictureClick not implemented." );
			}
			function InfoJetCustom_OnOpenView(isFirstView){
			}
			*/
		</script>
	</HEAD>
	<body onload="InfoJet_Init();">
		<table>
			<tr>
				<td>
					InfoJet Service 3.0 Build
					<asp:Label id="BuildVersionLabel" runat="server">BuildVersion</asp:Label>
				</td>
			</tr>
		</table>
		<form id="Form1" method="post" runat="server" style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px">
			<!-- The printing of the header and footer is supported by ScriptX[http://www.meadroid.com/scriptx/freedep.asp].
			<object id="factory" viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,3,434,26"></object>
			-->
			<TABLE id="RegisterTable" runat="server">
				<TR>
					<TD>Please select an InfoPath form template(.xsn) and register it to InfoJet 
						Service first:</TD>
				</TR>
				<TR>
					<TD>
						<input type="file" id="XSNFile" size="70" name="XSNFile" runat="server"> <input type="button" id="RegisterTemplateButton" runat="server" value="Register Form Template"
							onclick="document.forms['Form1'].encoding = 'multipart/form-data';" onserverclick="RegisterTemplateButton_ServerClick">
					</TD>
				</TR>
			</TABLE>
			<TABLE id="EditTable" runat="server" Width="750" Visible="false">
				<TR>
					<TD>Current registered InfoPath form template:</TD>
					<TD align="right">
						<input type="button" id="RegisterAnotherButton" runat="server" value="Register Another Template" onserverclick="RegisterAnotherButton_ServerClick"></TD>
				</TR>
				<TR>
					<TD colSpan="2">
						<asp:TextBox id="PublishUrlTextBox" runat="server" Enabled="false" style="width:750px;"></asp:TextBox></TD>
				</TR>
				<TR>
					<TD colSpan="2" nowrap>Please create a new InfoPath form or select an InfoPath form 
						based on the template to edit it:</TD>
				</TR>
				<TR>
					<TD colSpan="2" nowrap>
						<input type="button" id="NewFormButton" runat="server" value="New Form" onserverclick="NewFormButton_ServerClick"> <input type="file" id="XMLFile" size="75" name="XMLFile" runat="server">
						<input type="button" id="EditFormButton" runat="server" value="Edit Form" onclick="document.forms['Form1'].encoding = 'multipart/form-data';" onserverclick="EditFormButton_ServerClick"></TD>
				</TR>
			</TABLE>
			<TABLE id="FormTable" runat="server" Visible="false">
				<TR>
					<TD>&nbsp;</TD>
				</TR>
				<TR>
					<TD>
						<asp:Label id="xDocView" runat="server" EnableViewState="False">InfoPath Web Form will be shown here.</asp:Label></TD>
				</TR>
				<TR>
					<TD>
						<input type="button" id="SaveFormButton" runat="server" value="Save &amp; Refresh" onclick="document.forms['Form1'].encoding = 'application/x-www-form-urlencoded';" onserverclick="SaveFormButton_ServerClick">
						<input type="button" id="DownloadXMLButton" runat="server" value="Download XML" onclick="document.forms['Form1'].encoding = 'application/x-www-form-urlencoded';" onserverclick="DownloadXMLButton_ServerClick">
						<input id="PrintableVersionButton" value="Printable Version" type="button" onclick="InfoJet_OpenPrintableVersion(this);">
						<input type="button" id="CloseFormButton" runat="server" value="Close Form" onserverclick="CloseFormButton_ServerClick"> <input type="button" id="CloseWindowButton" runat="server" value="Close Window" onserverclick="CloseWindowButton_ServerClick">
					</TD>
				</TR>
			</TABLE>
		</form>
	</body>
</HTML>
